export const changeAble = {
  data () {
    return {
      timeBySecond: ''
    }
  },
  created () {
    this.getNowTimetoMinute()
  },
  methods: {
    getNowTimetoMinute () {
      var dateEnd = new Date()
      this.year = dateEnd.getFullYear()
      this.month = dateEnd.getMonth() < 10 ? '0' + (dateEnd.getMonth() + 1) : dateEnd.getMonth() + 1
      this.date = dateEnd.getDate()
      this.hour = dateEnd.getHours() < 10 ? '0' + dateEnd.getHours() : dateEnd.getHours()
      this.minute = dateEnd.getMinutes() < 10 ? '0' + dateEnd.getMinutes() : dateEnd.getMinutes()
      this.second = dateEnd.getSeconds() < 10 ? '0' + dateEnd.getSeconds() : dateEnd.getSeconds()
      var currentTime = this.year + '-' + this.month + '-' + this.date + ' ' + this.hour + ':' + this.minute + ':' + this.second
      console.log('currentTime mixin里面的', currentTime)
      this.timeBySecond = new Date(currentTime.replace(/-/g, '/')).getTime()
    },
    contrastTime (val) {
      var copys = JSON.parse(JSON.stringify(val))
      console.log(copys)
      var modifyTypeTime = ''
      modifyTypeTime = new Date(copys.completeCreateTime.replace(/-/g, '/')).getTime()
      var diff = this.timeBySecond - modifyTypeTime
      // console.log('diff', diff)
      var dayDiff = Math.floor(diff / (24 * 3600 * 1000))
      var diffHours = Math.floor(diff % (24 * 3600 * 1000) / (3600 * 1000))
      // console.log('diffHours', diffHours)
      var allHours = dayDiff * 24 + diffHours
      console.log('allHours', allHours)
      if (allHours >= 48) {
        return true
      } else {
        return false
      }
    }
  }
}
